home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_05 / gilhooly / winmain.c < prev   
C/C++ Source or Header  |  1995-03-12  |  2KB  |  74 lines

  1. #define GLOBALS TRUE
  2. #include "winjes.h"
  3. #undef GLOBALS
  4.  
  5. int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  6. {
  7.     MSG msg;
  8.  
  9.     if (!hPrevInstance)
  10.       if (!InitApplication(hInstance))
  11.         return (FALSE);             
  12.  
  13.     if (!InitInstance(hInstance, nCmdShow))
  14.     return (FALSE);
  15.  
  16.     while (GetMessage(&msg, NULL, NULL, NULL))
  17.     {
  18.       TranslateMessage(&msg);
  19.       DispatchMessage(&msg); 
  20.     }
  21.     
  22.     return (msg.wParam);
  23. }
  24.  
  25.  
  26. BOOL InitApplication(hInstance)
  27.     HANDLE hInstance;
  28. {
  29.     WNDCLASS  wc;
  30.  
  31.     wc.style = CS_DBLCLKS;
  32.     wc.lpfnWndProc = MainWndProc; 
  33.     wc.cbClsExtra = 0;
  34.     wc.cbWndExtra = 0;
  35.     wc.hInstance = hInstance;
  36.     wc.hIcon = LoadIcon(hInstance, "TellMe");
  37.     wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  38.     wc.hbrBackground = GetStockObject(WHITE_BRUSH); 
  39.     wc.lpszMenuName =  NULL;
  40.     wc.lpszClassName = "jesWClass";
  41.  
  42.     return (RegisterClass(&wc));
  43.  
  44. }
  45.  
  46. BOOL InitInstance(HANDLE hInstance, int nCmdShow)
  47. {
  48.     HWND            hWnd;
  49.  
  50.     hInst = hInstance;
  51.  
  52.     hWnd = CreateWindow("jesWClass",
  53.                         "WinJES",
  54.                         WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
  55.                         CW_USEDEFAULT,      
  56.                         CW_USEDEFAULT,      
  57.                         70,
  58.                         50,
  59.                         NULL,
  60.                         NULL,
  61.                         hInstance,
  62.                         NULL);
  63.  
  64.     if (!hWnd)
  65.       return (FALSE);
  66.  
  67.     ShowWindow(hWnd, nCmdShow);
  68.     UpdateWindow(hWnd);
  69.     return (TRUE);     
  70.  
  71. }
  72.  
  73.  
  74.